﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="3-9.aspx.cs" Inherits="实验三._3_9" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        </div>
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="LinqDataSource1" DataKeyNames="id" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" >
            <Columns>
                <asp:CommandField ShowSelectButton="True" />
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />
                <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" ReadOnly="True" />
            </Columns>

             </asp:GridView>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="实验三.DataClasses1DataContext" EntityTypeName="" Select="new (id, name)" TableName="Student">
        </asp:LinqDataSource>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="id" DataSourceID="LinqDataSource2" >
       
            <Fields>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />
                <asp:BoundField DataField="name" HeaderText="name" SortExpression="name" />
                <asp:BoundField DataField="sex" HeaderText="sex" SortExpression="sex" />
                <asp:BoundField DataField="img" HeaderText="img" SortExpression="img" />
                <asp:BoundField DataField="cid" HeaderText="cid" SortExpression="cid" />
                <asp:BoundField DataField="score" HeaderText="score" SortExpression="score" />
                <asp:BoundField DataField="sclass" HeaderText="sclass" SortExpression="sclass" />
            </Fields>
            
        </asp:DetailsView>

        <asp:LinqDataSource ID="LinqDataSource2" runat="server" ContextTypeName="实验三.DataClasses1DataContext" EntityTypeName="" TableName="Student" Where="id == @id" EnableDelete="True" EnableInsert="True" EnableUpdate="True">
        <WhereParameters>
                <asp:ControlParameter ControlID="GridView1" Name="id" PropertyName="SelectedValue" Type="String" />
            </WhereParameters>
        </asp:LinqDataSource>

    </form>
</body>
</html>
